﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LCA.Community.DAL.Model;

namespace LCA.Community.DAL.Test.ModelFactories
{
    public class MessagesFactory
    {
        int _count = 0;

        public MessagesFactory()
        {

        }

        public Message CreateEntity(string user, List<string> recipents)
        {
            var message = new Message(
                                        user,
                                        String.Format("This is the message {0} sent by {1}",_count,user),
                                        String.Format("This is the body of the messafe {0}.",_count),
                                        recipents
                                     );
            ++_count;
            return message;
        }

        public Message CreateHelpRequest(string user, string recipent)
        {
            var message = CreateEntity(user, new List<string> { recipent, Message.HelpPool });
            message.Subject = "Help Request: " + message.Subject;

            return message;
        }

        public List<Message> CreateList(int count,string user, List<string> recipents)
        {
            var messages = new List<Message>();

            for (int i = 0; i < count; i++)
            {
                messages.Add(CreateEntity(user, recipents));
                ++_count;
            }

            return messages;
        }
    }
}
